package com.cn.mmd.service;

import com.cn.mmd.mapper.StuCourseLabelMapper;
import com.cn.mmd.mapper.StudentPushLabelMapper;
import com.cn.mmd.model.StuCourseLabel;
import com.cn.mmd.model.StudentPushLabel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by Administrator on 2016/12/8.
 */
@Service("StuCourseLabelService")
public class StuCourseLabelServiceImpl implements StuCourseLabelService {

    @Autowired
    StuCourseLabelMapper stuCourseLabelMapper;
    @Autowired
    StudentPushLabelMapper studentPushLabelMapper;


    /**
     * 条件动态查询
     * @return
     */
    public List<StuCourseLabel> dynamicSearch(StuCourseLabel stuCourseLabel){
        return stuCourseLabelMapper.dynamicSearch(stuCourseLabel);
    }


    /**
     * 通过班级查找该课程最新的一条
     * @param stuCourseLabel
     * @return
     */
    public List<StuCourseLabel> selectLastByClass(StuCourseLabel stuCourseLabel){
        return stuCourseLabelMapper.selectLastByClass(stuCourseLabel);
    }


    /**
     * 添加推送
     * @param stuCourseLabel
     * @return
     */
    public int insertStuCourseLabel(StuCourseLabel stuCourseLabel){
        return stuCourseLabelMapper.insertSelective(stuCourseLabel);
    }


    /**
     * 通过学生找出48小时之内的推送
     * @return
     */
    public List<StuCourseLabel> selectTwoDaysByStudentId(StuCourseLabel stuCourseLabel){
        return stuCourseLabelMapper.selectTwoDaysByStudentId(stuCourseLabel);
    }


    /**
     * 查询学生-推送表
     * @return
     */
    public List<StudentPushLabel> selectStudentPushLabel(StudentPushLabel studentPushLabel){
        return studentPushLabelMapper.selectStudentPushLabel(studentPushLabel);
    }


    /**
     * 添加学生-推送表
     * @return
     */
    public int insertStudentPushLabel(StudentPushLabel studentPushLabel){
        return studentPushLabelMapper.insertSelective(studentPushLabel);
    }


    /**
     * 推送表中查出当天要推送标签的班级（去重）
     * @param shouldPushTime
     * @return
     */
    public List<StuCourseLabel> selectClassShouldPush(String shouldPushTime){
        return stuCourseLabelMapper.selectClassShouldPush(shouldPushTime);
    }
}
